package com.qzw.aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class LogRecord {
    @Before("execution(* com.qzw.service.CartService.*(..))") //Before注解表明当前通知为前置通知
    public void beforeAddCart() {
        System.out.println("前置通知:在目标方法前执行....");
    }

    @Around("execution(* com.qzw.service.CartService.*(..))")
    public void aroundAddCart(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        System.out.println("环绕通知:在目标方法之前执行>>>>>>>>>>>");

        proceedingJoinPoint.proceed();

        System.out.println("环绕通知:在目标方法之后执行>>>>>>>>>>>");

    }

}